function Cammera() {"use strict";
	// Cammera position
	this.x = 0;
	this.y = 0;
	// Cammera speed
	this.speed_x = 0;
	this.speed_y = 0;
}

// Handles mouse movement on main canvas
Cammera.prototype.updateCammeraCoordinates = function(newCammeraX, newCammeraY) {"use strict";
	// updates position
	this.x = newCammeraX;
	this.y = newCammeraY;
};

// Updates cammera taking into account keyboard events
Cammera.prototype.update = function() {"use strict";
	if (KeyboardInputHandler.keysPressed[Keys.RIGHT_ARROW]) {
		if (this.speed_x < 50) {
			this.speed_x = this.speed_x + 10;
		}
	} else if (KeyboardInputHandler.keysPressed[Keys.LEFT_ARROW]) {
		if (this.speed_x > -50) {
			this.speed_x = this.speed_x - 10;
		}
	} else {
		if (this.speed_x > 1 || this.speed_x < -1) {
			this.speed_x /= 2;
		} else {
			this.speed_x = 0;
		}
	}
	if (KeyboardInputHandler.keysPressed[Keys.DOWN_ARROW]) {
		if (this.speed_y < 50) {
			this.speed_y = this.speed_y + 10;
		}
	} else if (KeyboardInputHandler.keysPressed[Keys.UP_ARROW]) {
		if (this.speed_y > -50) {
			this.speed_y = this.speed_y - 10;
		}
	} else {
		if (this.speed_y > 1 || this.speed_y < -1) {
			this.speed_y /= 2;
		} else {
			this.speed_y = 0;
		}
	}
	//
	this.x = this.x + this.speed_x;
	this.y = this.y + this.speed_y;
};

// Set initial position after map load.
// i,j are the coordinates in terms of tiles.
Cammera.prototype.setPosition = function(i, j) {"use strict";
	this.x = CoordinatesUtil.getX(i, j, 0, 0) - window.innerWidth / 2;
	this.y = -CoordinatesUtil.getY(i, j, 0, 0) - window.innerHeight / 2;

	this.speed_x = 0;
	this.speed_y = 0;
};

